package JVM.DynamicProxy;

import java.lang.reflect.Method;

//反射
public class method2 {
    public int add(int a,int b){
        return a+b;
    }

    public static void main(String[] args) throws Exception{
        Class<?> cls = Class.forName("JVM.DynamicProxy.method2");
        Class[] partTypes=new Class[2];
        partTypes[0]=Integer.TYPE;
        partTypes[1]=Integer.TYPE;
        Method add_method = cls.getMethod("add", partTypes);
        Integer i=new Integer(6);
        Integer i2=new Integer(10);
        method2 method2=new method2();
        Object res = add_method.invoke(method2, i, i2);
        int resi=(Integer)res;
        System.out.println(resi);
    }
}
